package ac.zlf.springmybatis.admin.bjui.controller;

import ac.zlf.springmybatis.admin.bjui.constant.Uri;
import ac.zlf.springmybatis.base.entity.User;
import ac.zlf.springmybatis.service.AmenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2017/4/16 0016.
 */
@Controller
public class IndexController {
    @Autowired
    private AmenuService amenuService;

    @RequestMapping(Uri.LOGIN)
    public String show(){
        return "login";
    }

    @RequestMapping(value = Uri.INDEX)
    public ModelAndView showIndex(HttpServletRequest request) {
        ModelAndView modelAndView = new ModelAndView("index");
        modelAndView.addObject("menuVo",amenuService.getMenu(new User()));
        return modelAndView;
    }

    @RequestMapping(Uri.INDEX_LAYOUT)
    public String showIndexLayout(){
        return "index_layout";
    }

}
